

package com.hazelcast.client.config.impl;

/**
 * Configuration sections for the clients shared by XML and YAML based
 * configurations
 */
public enum ClientFailoverConfigSections {
    CLIENT_FAILOVER("hazelcast-client-failover", false), CLIENTS("clients", false), TRY_COUNT("try-count", false);

    final boolean multipleOccurrence;
    private final String name;

    ClientFailoverConfigSections(String name, boolean multipleOccurrence) {
        this.name = name;
        this.multipleOccurrence = multipleOccurrence;
    }

    public static boolean canOccurMultipleTimes(String name) {
        for (ClientFailoverConfigSections element : values()) {
            if (name.equals(element.name)) {
                return element.multipleOccurrence;
            }
        }
        return true;
    }

    public boolean isEqual(String name) {
        return this.name.equals(name);
    }

    public String getName() {
        return name;
    }
}
